home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
LIBRARY
/
DMTDEMOS
/
WRTSECT.DEM
< prev
Wrap
Text File
|
1994-07-02
|
2KB
|
59 lines
program WrtSectSample;
{
This program uses the WrtSect procedure to fill a floppy disk sector
with the character 'A'.
}
uses crt, DMT;
var
SectorBuffer : array[ 1..512 ] of char;
SectToWrite,
HeadToWrite,
CylToWrite : word;
DrvLetter : char;
begin
fillchar( SectorBuffer, SizeOf( SectorBuffer ), 'A' );
Color( 7, 0 );
clrscr;
writeln('Warning! : In general, it is safe to make read sectors operations from' );
writeln(' the disk, but this is not the case for write operations. If' );
writeln(' you write to a sector that has important information used by' );
writeln(' DOS, you can make the disk unusable. While you are experimen-' );
writeln(' ting with this routine practice only with an unused or empty' );
writeln(' FLOPPY disk, NEVER use a HARD DISK to practice.');
writeln( #7 );
writeln( 'Press <Ctrl-Break> to abort, <Enter> to continue ');
readln;
write( 'Select drive ( A-Z ) [ :]');
gotoxy( wherex - 3, wherey );
DrvLetter := upcase( readkey );
writeln( DrvLetter );
HeadToWrite := 1; { Write to disk side 1 }
CylToWrite := 0; { Write to disk track 0 }
SectToWrite := 1; { Write to disk track 1 }
WrtSect( DrvLetter, HeadToWrite, CylToWrite, SectToWrite, 1, addr( SectorBuffer ) ); { Call WrtSect procedure }
if ( ErrFlag ) then
begin
writeln( #7 );
writeln( ShowError( GetErrCode ) );
end
else
begin
clrscr;
writeln;
writeln( 'Sector has been write, use READSECT to check.' );
end;
GetEnter;
end.